package com.cx.demo.configure;

import com.cx.demo.LinuxCondition;
import com.cx.demo.WindowsCondition;
import com.cx.demo.bean.LinuxShowDir;
import com.cx.demo.bean.WindowsShowDir;
import com.cx.demo.inter.ShowDir;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;

/**
 * @author xiongmin
 * @version 1.0
 * @date 20-8-19 下午2:27
 */
@Configuration
@ComponentScan(basePackages = "com.cx.demo")
public class JavaConfigure {
    @Bean("dircmd")
    @Conditional(LinuxCondition.class)
    public ShowDir linuxShowDir() {
        return new LinuxShowDir();
    }

    @Bean("dircmd")
    @Conditional(WindowsCondition.class)
    public ShowDir windowsShowDir() {
        return new WindowsShowDir();
    }
}
